/*
 * MemoryMaps.h
 *
 *  Created on: May 26, 2011
 *      Author: stud
 */

#ifndef MEMORYMAPS_H_
#define MEMORYMAPS_H_

#include "Map.h"
#include "CountingSemaphore.h"

#include <vector>

using namespace std;


class MemoryMaps{

private:



	Map * maps[2];
	int mapNum;

	CountingSemaphore * sem[2];

	int writeMapFlag;
	CountingSemaphore * flagSem;

public:

	void writeFlagUp();

	void writeFlagDown();

	int getWriteMapFlag();

	void initializeMaps(int mode);

	sWord * getMapContents(int mapNumber,sWord * buffer);
	void setMapContents(int mapNumber, sWord * buffer);

	void printMemoryMaps();

	sWord * copyBuffer(sWord *dest, sWord *source, int positions);

	MemoryMaps(int maps);
	~MemoryMaps();



};



#endif /* MEMORYMAPS_H_ */
